﻿using Architecture.Repository.Interface;
using Architeture.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Architecture.Domain.Service
{
    public class FarmingService : IFarmingService
    {
        protected readonly IFarmingRepsotory farmingRepsotory;

        public FarmingService(IFarmingRepsotory farmingRepsotory)
        {
            this.farmingRepsotory = farmingRepsotory;
        }

        public async Task<int> farmingAdd(Farming a)
        {
            return await farmingRepsotory.Update(a);
        }

        public async Task<Farming> farmingList(int id)
        {
            var list = (await farmingRepsotory.GetAllAsync()).FirstOrDefault(x => x.GoodsInfoid == id);
            return list;
        }
    }
}
